import { Message } from 'element-ui'
import request from '@/utils/request'

export const tableAdd = async (path, params) => {
  await request({
    url: path,
    method: 'post',
    data: {
      ...params
    }
  })
    .then(res => {
      if (res.data.success) {
        Message.success({
          message: '新增成功!'
        })
      } else {
        Message({
          type: 'error',
          message: '新增失败!'
        })
      }
    })
    .catch(() => {
      Message({
        type: 'error',
        message: '请求异常!'
      })
    })
}
